#ifndef MAINVIEW_H
#define MAINVIEW_H

#include <QDialog>
#include <QHeaderView>
#include <QStandardItemModel>
#include <QFileDialog>
#include <QtDebug>

#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <map>
using std::map;


// The class that handles the actual parsing of the GPX file
#include "gpxparser.h"

// Our intersection solver
#include "solverintersection.h"

// Our difference solver
#include "solverdifference.h"

// Our cache grouper
#include "solvercachegrouping.h"

namespace Ui
{
class MainView;
}

class MainView : public QDialog
{
    Q_OBJECT

public:
    explicit MainView(QWidget *parent = 0);
    ~MainView();

private:
    void setupWidgets();
    void resetOutputGrid();
    void addFilesToProcess(const QStringList& fileNames);
    bool processFiles();

private slots:
    void addFile();
    void removeFile();
    void showCommon();
    void showDifference();
    void saveResults();
    void setCurrentFileRow(QModelIndex index) {selectedFileModelIndex = index;}

private:
    Ui::MainView *ui;

    // Holds our cacher/file info
    QStandardItemModel* gpxFileModel;

    // The currently sectw in the file model
    QModelIndex selectedFileModelIndex;

    // The results
    QStandardItemModel* resultsModel;


    // This is the map we're going to store everything in
    map<string, vector<cache> > dataSet;
};

#endif // MAINVIEW_H
